Skip Headers

Oracle® Objects for OLE C++ Class Library Developer's Guide 10g Release 2 (10.2) Part Number B14308-01 |
Home | Book List | Contents | Index | Master Index | Feedback

# IsChanged Method

Applies To

OBinder

OBound

Description

This method returns TRUE if a change has been noted on the object.

Usage

oboolean IsChanged(void)

Remarks

An OBinder instance keeps track of whether the current record has been marked as changed. This marking is done with the Changed method, which is normally called by OBound subclass code rather than client code.

The OBound instance keeps track of whether its particular field has been marked as changed. This is marking is done with the Changed method, which is normally called by the OBound subclass code that makes the change to the OBound instance value.

Use IsChanged to determine whether the record or field has been changed.

Return Value

TRUE if the object's value has been marked as changed; FALSE otherwise.

Example

This example considers handling an OBinder when it is about to be closed.

    // Here's an OBinder that we are using to edit a table
    OBinder tableedit;
    // setup of tableedit goes here (see Workbook for a sample).

    // now the user is closing the window. Deal with any changes.
    if (tableedit.IsChanged())
    { // the current record has a change in it
        // ask the user if they want to save the change
        int yesno = Message("Do you want to save the change?");
        if (yesno == YES_ANSWER)
            tableedit.Update();
        else
            tableedit.DiscardChanges();
    }

    /*
    Now we can close the window.
    By the way, the default behavior when an OBinder is destroyed is for it to
    Update().
    */